package com.szxy.miaosha.dao;

import com.szxy.miaosha.domain.MiaoshaGoods;
import com.szxy.miaosha.domain.MiaoshaOrder;
import com.szxy.miaosha.vo.GoodsVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @Author: zwz
 * @Date:2020/9/8 23:52
 * @Description:com.szxy.miaosha.dao
 * @Version:1.0
 **/
@Mapper
public interface MiaoshaOrderDao {

    /**
     * 查询订单
     *
     * @param user_id
     * @param goodsId
     * @return
     */
    @Select("select * from miaosha_order where user_id = #{userId} and goods_id = #{goodsId}")
    MiaoshaOrder getMiaoShaOrderByUserIdAndGoodsId(@Param("userId") Long user_id, @Param("goodsId") Long goodsId);

    /**
     * 新增订单
     *
     * @param miaoshaOrder
     */
    @Insert("insert into miaosha_order(user_id, order_id, goods_id) values(#{userId},#{orderId}, #{goodsId})")
    void insertOrder(MiaoshaOrder miaoshaOrder);

}
